A r t i c l e s
Navigation

Note: This site is
a bit older, personal views
may have changed.

M a i n P a g e

D i r e c t o r y

Capture Delphi Form OnMove Event


You can capture when a form moves very easily, if your version of delphi does not include an OnMove event for your Form.
type
  TForm1 = class(TForm)
  private
    procedure OnMove(var Msg: TWMMove); message WM_MOVE;

  protected

  public

  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.OnMove(var Msg: TWMMove);
begin
  inherited;
  // to show that it works
  caption:= 'Moved! Left: ' + inttostr(left);
end;

For even more code clarity, you might want to make your own derived class for a custom form. That way you won't have to place the above code in each of your programs that you want to capture form movement.

About
This site is about programming and other things.
_ _ _